3.675 \(\int \frac{a+b \sin (e+f x)}{c+d \sin (e+f x)} \, dx\)

Optimal. Leaf size=65 \[ \frac{b x}{d}-\frac{2 (b c-a d) \tan ^{-1}\left (\frac{c \tan \left (\frac{1}{2} (e+f x)\right )+d}{\sqrt{c^2-d^2}}\right )}{d f \sqrt{c^2-d^2}} \]

[Out]

(b*x)/d - (2*(b*c - a*d)*ArcTan[(d + c*Tan[(e + f*x)/2])/Sqrt[c^2 - d^2]])/(d*Sqrt[c^2 - d^2]*f)

________________________________________________________________________________________

Rubi [A]  time = 0.0882793, antiderivative size = 65, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 4, integrand size = 23, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.174, Rules used = {2735, 2660, 618, 204} \[ \frac{b x}{d}-\frac{2 (b c-a d) \tan ^{-1}\left (\frac{c \tan \left (\frac{1}{2} (e+f x)\right )+d}{\sqrt{c^2-d^2}}\right )}{d f \sqrt{c^2-d^2}} \]

Antiderivative was successfully verified.

[In]

Int[(a + b*Sin[e + f*x])/(c + d*Sin[e + f*x]),x]

[Out]

(b*x)/d - (2*(b*c - a*d)*ArcTan[(d + c*Tan[(e + f*x)/2])/Sqrt[c^2 - d^2]])/(d*Sqrt[c^2 - d^2]*f)

Rule 2735

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])/((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(b*x)/d
, x] - Dist[(b*c - a*d)/d, Int[1/(c + d*Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d
, 0]

Rule 2660

Int[((a_) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{e = FreeFactors[Tan[(c + d*x)/2], x]}, Dis
t[(2*e)/d, Subst[Int[1/(a + 2*b*e*x + a*e^2*x^2), x], x, Tan[(c + d*x)/2]/e], x]] /; FreeQ[{a, b, c, d}, x] &&
 NeQ[a^2 - b^2, 0]

Rule 618

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Dist[-2, Subst[Int[1/Simp[b^2 - 4*a*c - x^2, x], x]
, x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 204

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> -Simp[ArcTan[(Rt[-b, 2]*x)/Rt[-a, 2]]/(Rt[-a, 2]*Rt[-b, 2]), x] /
; FreeQ[{a, b}, x] && PosQ[a/b] && (LtQ[a, 0] || LtQ[b, 0])

Rubi steps

\begin{align*} \int \frac{a+b \sin (e+f x)}{c+d \sin (e+f x)} \, dx &=\frac{b x}{d}-\frac{(b c-a d) \int \frac{1}{c+d \sin (e+f x)} \, dx}{d}\\ &=\frac{b x}{d}-\frac{(2 (b c-a d)) \operatorname{Subst}\left (\int \frac{1}{c+2 d x+c x^2} \, dx,x,\tan \left (\frac{1}{2} (e+f x)\right )\right )}{d f}\\ &=\frac{b x}{d}+\frac{(4 (b c-a d)) \operatorname{Subst}\left (\int \frac{1}{-4 \left (c^2-d^2\right )-x^2} \, dx,x,2 d+2 c \tan \left (\frac{1}{2} (e+f x)\right )\right )}{d f}\\ &=\frac{b x}{d}-\frac{2 (b c-a d) \tan ^{-1}\left (\frac{d+c \tan \left (\frac{1}{2} (e+f x)\right )}{\sqrt{c^2-d^2}}\right )}{d \sqrt{c^2-d^2} f}\\ \end{align*}

Mathematica [A]  time = 0.13013, size = 67, normalized size = 1.03 \[ \frac{\frac{(2 a d-2 b c) \tan ^{-1}\left (\frac{c \tan \left (\frac{1}{2} (e+f x)\right )+d}{\sqrt{c^2-d^2}}\right )}{\sqrt{c^2-d^2}}+b (e+f x)}{d f} \]

Antiderivative was successfully verified.

[In]

Integrate[(a + b*Sin[e + f*x])/(c + d*Sin[e + f*x]),x]

[Out]

(b*(e + f*x) + ((-2*b*c + 2*a*d)*ArcTan[(d + c*Tan[(e + f*x)/2])/Sqrt[c^2 - d^2]])/Sqrt[c^2 - d^2])/(d*f)

________________________________________________________________________________________

Maple [A]  time = 0.043, size = 119, normalized size = 1.8 \begin{align*} 2\,{\frac{a}{f\sqrt{{c}^{2}-{d}^{2}}}\arctan \left ( 1/2\,{\frac{2\,c\tan \left ( 1/2\,fx+e/2 \right ) +2\,d}{\sqrt{{c}^{2}-{d}^{2}}}} \right ) }-2\,{\frac{cb}{df\sqrt{{c}^{2}-{d}^{2}}}\arctan \left ( 1/2\,{\frac{2\,c\tan \left ( 1/2\,fx+e/2 \right ) +2\,d}{\sqrt{{c}^{2}-{d}^{2}}}} \right ) }+2\,{\frac{b\arctan \left ( \tan \left ( 1/2\,fx+e/2 \right ) \right ) }{df}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+b*sin(f*x+e))/(c+d*sin(f*x+e)),x)

[Out]

2/f/(c^2-d^2)^(1/2)*arctan(1/2*(2*c*tan(1/2*f*x+1/2*e)+2*d)/(c^2-d^2)^(1/2))*a-2/f/d/(c^2-d^2)^(1/2)*arctan(1/
2*(2*c*tan(1/2*f*x+1/2*e)+2*d)/(c^2-d^2)^(1/2))*c*b+2/f*b/d*arctan(tan(1/2*f*x+1/2*e))

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sin(f*x+e))/(c+d*sin(f*x+e)),x, algorithm="maxima")

[Out]

Exception raised: ValueError

________________________________________________________________________________________

Fricas [A]  time = 1.71969, size = 547, normalized size = 8.42 \begin{align*} \left [\frac{2 \,{\left (b c^{2} - b d^{2}\right )} f x +{\left (b c - a d\right )} \sqrt{-c^{2} + d^{2}} \log \left (\frac{{\left (2 \, c^{2} - d^{2}\right )} \cos \left (f x + e\right )^{2} - 2 \, c d \sin \left (f x + e\right ) - c^{2} - d^{2} + 2 \,{\left (c \cos \left (f x + e\right ) \sin \left (f x + e\right ) + d \cos \left (f x + e\right )\right )} \sqrt{-c^{2} + d^{2}}}{d^{2} \cos \left (f x + e\right )^{2} - 2 \, c d \sin \left (f x + e\right ) - c^{2} - d^{2}}\right )}{2 \,{\left (c^{2} d - d^{3}\right )} f}, \frac{{\left (b c^{2} - b d^{2}\right )} f x +{\left (b c - a d\right )} \sqrt{c^{2} - d^{2}} \arctan \left (-\frac{c \sin \left (f x + e\right ) + d}{\sqrt{c^{2} - d^{2}} \cos \left (f x + e\right )}\right )}{{\left (c^{2} d - d^{3}\right )} f}\right ] \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sin(f*x+e))/(c+d*sin(f*x+e)),x, algorithm="fricas")

[Out]

[1/2*(2*(b*c^2 - b*d^2)*f*x + (b*c - a*d)*sqrt(-c^2 + d^2)*log(((2*c^2 - d^2)*cos(f*x + e)^2 - 2*c*d*sin(f*x +
 e) - c^2 - d^2 + 2*(c*cos(f*x + e)*sin(f*x + e) + d*cos(f*x + e))*sqrt(-c^2 + d^2))/(d^2*cos(f*x + e)^2 - 2*c
*d*sin(f*x + e) - c^2 - d^2)))/((c^2*d - d^3)*f), ((b*c^2 - b*d^2)*f*x + (b*c - a*d)*sqrt(c^2 - d^2)*arctan(-(
c*sin(f*x + e) + d)/(sqrt(c^2 - d^2)*cos(f*x + e))))/((c^2*d - d^3)*f)]

________________________________________________________________________________________

Sympy [A]  time = 151.013, size = 502, normalized size = 7.72 \begin{align*} \begin{cases} \frac{\tilde{\infty } x \left (a + b \sin{\left (e \right )}\right )}{\sin{\left (e \right )}} & \text{for}\: c = 0 \wedge d = 0 \wedge f = 0 \\\frac{\frac{a \log{\left (\tan{\left (\frac{e}{2} + \frac{f x}{2} \right )} \right )}}{f} + b x}{d} & \text{for}\: c = 0 \\\frac{2 a}{d f \tan{\left (\frac{e}{2} + \frac{f x}{2} \right )} - d f} + \frac{b f x \tan{\left (\frac{e}{2} + \frac{f x}{2} \right )}}{d f \tan{\left (\frac{e}{2} + \frac{f x}{2} \right )} - d f} - \frac{b f x}{d f \tan{\left (\frac{e}{2} + \frac{f x}{2} \right )} - d f} + \frac{2 b}{d f \tan{\left (\frac{e}{2} + \frac{f x}{2} \right )} - d f} & \text{for}\: c = - d \\- \frac{2 a}{d f \tan{\left (\frac{e}{2} + \frac{f x}{2} \right )} + d f} + \frac{b f x \tan{\left (\frac{e}{2} + \frac{f x}{2} \right )}}{d f \tan{\left (\frac{e}{2} + \frac{f x}{2} \right )} + d f} + \frac{b f x}{d f \tan{\left (\frac{e}{2} + \frac{f x}{2} \right )} + d f} + \frac{2 b}{d f \tan{\left (\frac{e}{2} + \frac{f x}{2} \right )} + d f} & \text{for}\: c = d \\\frac{a x - \frac{b \cos{\left (e + f x \right )}}{f}}{c} & \text{for}\: d = 0 \\\frac{x \left (a + b \sin{\left (e \right )}\right )}{c + d \sin{\left (e \right )}} & \text{for}\: f = 0 \\- \frac{a d \sqrt{- c^{2} + d^{2}} \log{\left (\tan{\left (\frac{e}{2} + \frac{f x}{2} \right )} + \frac{d}{c} - \frac{\sqrt{- c^{2} + d^{2}}}{c} \right )}}{c^{2} d f - d^{3} f} + \frac{a d \sqrt{- c^{2} + d^{2}} \log{\left (\tan{\left (\frac{e}{2} + \frac{f x}{2} \right )} + \frac{d}{c} + \frac{\sqrt{- c^{2} + d^{2}}}{c} \right )}}{c^{2} d f - d^{3} f} + \frac{b c^{2} f x}{c^{2} d f - d^{3} f} + \frac{b c \sqrt{- c^{2} + d^{2}} \log{\left (\tan{\left (\frac{e}{2} + \frac{f x}{2} \right )} + \frac{d}{c} - \frac{\sqrt{- c^{2} + d^{2}}}{c} \right )}}{c^{2} d f - d^{3} f} - \frac{b c \sqrt{- c^{2} + d^{2}} \log{\left (\tan{\left (\frac{e}{2} + \frac{f x}{2} \right )} + \frac{d}{c} + \frac{\sqrt{- c^{2} + d^{2}}}{c} \right )}}{c^{2} d f - d^{3} f} - \frac{b d^{2} f x}{c^{2} d f - d^{3} f} & \text{otherwise} \end{cases} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sin(f*x+e))/(c+d*sin(f*x+e)),x)

[Out]

Piecewise((zoo*x*(a + b*sin(e))/sin(e), Eq(c, 0) & Eq(d, 0) & Eq(f, 0)), ((a*log(tan(e/2 + f*x/2))/f + b*x)/d,
 Eq(c, 0)), (2*a/(d*f*tan(e/2 + f*x/2) - d*f) + b*f*x*tan(e/2 + f*x/2)/(d*f*tan(e/2 + f*x/2) - d*f) - b*f*x/(d
*f*tan(e/2 + f*x/2) - d*f) + 2*b/(d*f*tan(e/2 + f*x/2) - d*f), Eq(c, -d)), (-2*a/(d*f*tan(e/2 + f*x/2) + d*f)
+ b*f*x*tan(e/2 + f*x/2)/(d*f*tan(e/2 + f*x/2) + d*f) + b*f*x/(d*f*tan(e/2 + f*x/2) + d*f) + 2*b/(d*f*tan(e/2
+ f*x/2) + d*f), Eq(c, d)), ((a*x - b*cos(e + f*x)/f)/c, Eq(d, 0)), (x*(a + b*sin(e))/(c + d*sin(e)), Eq(f, 0)
), (-a*d*sqrt(-c**2 + d**2)*log(tan(e/2 + f*x/2) + d/c - sqrt(-c**2 + d**2)/c)/(c**2*d*f - d**3*f) + a*d*sqrt(
-c**2 + d**2)*log(tan(e/2 + f*x/2) + d/c + sqrt(-c**2 + d**2)/c)/(c**2*d*f - d**3*f) + b*c**2*f*x/(c**2*d*f -
d**3*f) + b*c*sqrt(-c**2 + d**2)*log(tan(e/2 + f*x/2) + d/c - sqrt(-c**2 + d**2)/c)/(c**2*d*f - d**3*f) - b*c*
sqrt(-c**2 + d**2)*log(tan(e/2 + f*x/2) + d/c + sqrt(-c**2 + d**2)/c)/(c**2*d*f - d**3*f) - b*d**2*f*x/(c**2*d
*f - d**3*f), True))

________________________________________________________________________________________

Giac [A]  time = 1.32551, size = 116, normalized size = 1.78 \begin{align*} \frac{\frac{{\left (f x + e\right )} b}{d} - \frac{2 \,{\left (\pi \left \lfloor \frac{f x + e}{2 \, \pi } + \frac{1}{2} \right \rfloor \mathrm{sgn}\left (c\right ) + \arctan \left (\frac{c \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) + d}{\sqrt{c^{2} - d^{2}}}\right )\right )}{\left (b c - a d\right )}}{\sqrt{c^{2} - d^{2}} d}}{f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sin(f*x+e))/(c+d*sin(f*x+e)),x, algorithm="giac")

[Out]

((f*x + e)*b/d - 2*(pi*floor(1/2*(f*x + e)/pi + 1/2)*sgn(c) + arctan((c*tan(1/2*f*x + 1/2*e) + d)/sqrt(c^2 - d
^2)))*(b*c - a*d)/(sqrt(c^2 - d^2)*d))/f